home *** CD-ROM | disk | FTP | other *** search
- Path: condor.navsses.navy.mil!mdipilla
- From: mdipilla@condor.navsses.navy.mil
- Newsgroups: comp.lang.c
- Subject: Help! Initializing a C string
- Message-ID: <1996Mar18.095842.2435@condor>
- Date: 18 Mar 96 09:58:42 -0600
- Organization: CDNSWC, Naval Ship Systems Eng Sta, Phila PA
-
- to whom is all C' knowing...
-
- I have a string which is formulating by several lines from an input file.
- The approach we hae taken is to do a strncpy of the first line and then
- strncat of each additional line.
-
- When the string is formed we need to null it out so we can read the next
- string in.
-
- The problem we are having is that if we set the string to "\0"
- we
-
- 1. Overwrite the first line (strcpy)
- 2. However the 2nd, 3rd, 4th, etch lines of the string are concatenated
- after the initial string that wwas written.
-
- how do you INIitialze the variable of the string so it is clear and you
- do not have this overwrite problem.
-
- Michael
- (215) 897-1051
-
-
-